/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import DAO.*;
import DTO.*;
import java.util.List;

import java.util.List;
import java.util.ArrayList;
import java.util.Date;
import java.util.regex.*;

import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;




import java.awt.event.*;

import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.swing.JRViewer;

/**
 *
 * @author Luis Olave 10
 */
public class ModificacionGarantiaCdp extends javax.swing.JFrame {
    garantiaCdpOtrosDTO garaCdp = new garantiaCdpOtrosDTO();
    usuarioDTO user;
    garantiasDAO reg = new garantiasDAO();

    /**
     * Creates new form ModificacionGarantiaCdp
     */
    public ModificacionGarantiaCdp(usuarioDTO user) {
        initComponents();
        this.user = user;
        pnlBuscarNumero.setVisible(false);
        chkFolioModCDP.setSelected(true);
        this.btnActualizarModCDP.setVisible(false);
        cargarItemsComboBoxSucursal();
        cargarItemsComboBoxMoneda();
        cargarItemsComboBoxTipoGarantia();
        this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
    }

    private void cargarItemsComboBoxSucursal() {
        List<sucursalDTO> ListaSucursal = CCSucursal.listarItemSucursal();
        if (ListaSucursal != null) {
            int size = ListaSucursal.size();
            for (int i = 0; i < size; i++) {
                this.cmbSucursalModCDP.addItem(ListaSucursal.get(i));
            }
        }
    }

    private void cargarItemsComboBoxMoneda() {
        List<monedaDTO> ListaMoneda = CCMoneda.listarItemMoneda();
        if (ListaMoneda != null) {
            int size = ListaMoneda.size();
            for (int i = 0; i < size; i++) {
                this.cmbMonedaModCDP.addItem(ListaMoneda.get(i));
            }
        }
    }

    private void cargarItemsComboBoxTipoGarantia() {
        List<tipoGarantiaDTO> ListaTipoGarantia = CCTipoGarantia.listarItemTipoGarantia();
        if (ListaTipoGarantia != null) {
            int size = ListaTipoGarantia.size();
            for (int i = 0; i < size; i++) {
                this.cmbGtiaModCDP.addItem(ListaTipoGarantia.get(i));
            }
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        btnMenuPrincipal = new javax.swing.JButton();
        pnlDatosPersoGara = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jLabel36 = new javax.swing.JLabel();
        jLabel37 = new javax.swing.JLabel();
        jLabel39 = new javax.swing.JLabel();
        jLabel40 = new javax.swing.JLabel();
        txtNombreModCDP = new javax.swing.JTextField();
        txtApellMatModCDP = new javax.swing.JTextField();
        txtApellPatModCDP = new javax.swing.JTextField();
        txtRutModCDP = new javax.swing.JTextField();
        pnlBuscarFolio = new javax.swing.JPanel();
        jLabel30 = new javax.swing.JLabel();
        txtFolioModCDP = new javax.swing.JTextField();
        btnFolioModCDP = new javax.swing.JButton();
        chkFolioModCDP = new javax.swing.JCheckBox();
        chkNumModCDP = new javax.swing.JCheckBox();
        pnlBuscarNumero = new javax.swing.JPanel();
        jLabel31 = new javax.swing.JLabel();
        txtNumModCDP = new javax.swing.JTextField();
        btnNumModCDP = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        pnlDescripGarantia = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        txtOtroComentarioModCDP = new javax.swing.JTextArea();
        jScrollPane4 = new javax.swing.JScrollPane();
        txtDescripcionModCDP = new javax.swing.JTextArea();
        lblDescripcion = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        cmbSucursalModCDP = new javax.swing.JComboBox();
        jLabel13 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        cmbMonedaModCDP = new javax.swing.JComboBox();
        jcUltimoDebito = new com.toedter.calendar.JDateChooser();
        jcUltimaTasacion = new com.toedter.calendar.JDateChooser();
        jcFechaModifica = new com.toedter.calendar.JDateChooser();
        txtFechaCreacion = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        txtNumeroCDPMOD = new javax.swing.JTextField();
        jPanel6 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        cmbGtiaModCDP = new javax.swing.JComboBox();
        jcFechaExtincion = new com.toedter.calendar.JDateChooser();
        jcUltimoRevaluo = new com.toedter.calendar.JDateChooser();
        jcUltimoCredito = new com.toedter.calendar.JDateChooser();
        jPanel10 = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        txtArchivo1ModCDP = new javax.swing.JTextField();
        btnExaminarModCDP = new javax.swing.JButton();
        btnAdjuntarModCDP = new javax.swing.JButton();
        btnMenuPricModCDP = new javax.swing.JButton();
        btnActualizarModCDP = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tbSalidaImprimirCdp = new javax.swing.JTable();
        jPanel11 = new javax.swing.JPanel();
        txtBuscarCdpImprimir = new javax.swing.JTextField();
        btnBuscarCdpImprimir = new javax.swing.JButton();
        btnImprimirCdp = new javax.swing.JButton();
        btnMenuPrincipalCdp = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("MODIFICACIÓN GARANTÍA CDP");
        setResizable(false);

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/IMAGE/logo.JPG"))); // NOI18N

        jLabel1.setFont(new java.awt.Font("Century Gothic", 1, 18)); // NOI18N
        jLabel1.setText("MODIFICACIÓN GARANTÍA CDP");

        jTabbedPane1.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N

        btnMenuPrincipal.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnMenuPrincipal.setText(" MENÚ PRINCIPAL");
        btnMenuPrincipal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMenuPrincipalActionPerformed(evt);
            }
        });

        pnlDatosPersoGara.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "DATOS PERSONALES GARANTE", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        jLabel36.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel36.setText("RUT");

        jLabel37.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel37.setText("APELLIDO PATERNO");

        jLabel39.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel39.setText("APELLIDO MATERNO");

        jLabel40.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel40.setText("NOMBRE");

        txtNombreModCDP.setBackground(new java.awt.Color(255, 255, 102));
        txtNombreModCDP.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtNombreModCDP.setEnabled(false);

        txtApellMatModCDP.setBackground(new java.awt.Color(255, 255, 102));
        txtApellMatModCDP.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtApellMatModCDP.setEnabled(false);

        txtApellPatModCDP.setBackground(new java.awt.Color(255, 255, 102));
        txtApellPatModCDP.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtApellPatModCDP.setEnabled(false);

        txtRutModCDP.setBackground(new java.awt.Color(255, 255, 102));
        txtRutModCDP.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtRutModCDP.setEnabled(false);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel37)
                    .addComponent(jLabel36))
                .addGap(18, 18, 18)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtRutModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtApellPatModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 85, Short.MAX_VALUE)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel39)
                    .addComponent(jLabel40))
                .addGap(18, 18, 18)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtNombreModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtApellMatModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(196, 196, 196))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel36)
                    .addComponent(txtRutModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel40)
                    .addComponent(txtNombreModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel37)
                    .addComponent(txtApellPatModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel39)
                    .addComponent(txtApellMatModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        javax.swing.GroupLayout pnlDatosPersoGaraLayout = new javax.swing.GroupLayout(pnlDatosPersoGara);
        pnlDatosPersoGara.setLayout(pnlDatosPersoGaraLayout);
        pnlDatosPersoGaraLayout.setHorizontalGroup(
            pnlDatosPersoGaraLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatosPersoGaraLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        pnlDatosPersoGaraLayout.setVerticalGroup(
            pnlDatosPersoGaraLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlDatosPersoGaraLayout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pnlBuscarFolio.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "INGRESE N° FOLIO", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        jLabel30.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel30.setText("FOLIO");

        btnFolioModCDP.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnFolioModCDP.setText("BUSCAR");
        btnFolioModCDP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnFolioModCDPActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlBuscarFolioLayout = new javax.swing.GroupLayout(pnlBuscarFolio);
        pnlBuscarFolio.setLayout(pnlBuscarFolioLayout);
        pnlBuscarFolioLayout.setHorizontalGroup(
            pnlBuscarFolioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlBuscarFolioLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel30)
                .addGap(18, 18, 18)
                .addGroup(pnlBuscarFolioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtFolioModCDP)
                    .addComponent(btnFolioModCDP, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE))
                .addContainerGap(59, Short.MAX_VALUE))
        );
        pnlBuscarFolioLayout.setVerticalGroup(
            pnlBuscarFolioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlBuscarFolioLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnlBuscarFolioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel30)
                    .addComponent(txtFolioModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnFolioModCDP)
                .addContainerGap())
        );

        buttonGroup1.add(chkFolioModCDP);
        chkFolioModCDP.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        chkFolioModCDP.setText("BUSCAR POR N° FOLIO");
        chkFolioModCDP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkFolioModCDPActionPerformed(evt);
            }
        });

        buttonGroup1.add(chkNumModCDP);
        chkNumModCDP.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        chkNumModCDP.setText("BUSCAR POR NÚMERO");
        chkNumModCDP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkNumModCDPActionPerformed(evt);
            }
        });

        pnlBuscarNumero.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "INGRESE N°", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        jLabel31.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel31.setText("NÚMERO CDP");

        btnNumModCDP.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnNumModCDP.setText("BUSCAR");
        btnNumModCDP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNumModCDPActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlBuscarNumeroLayout = new javax.swing.GroupLayout(pnlBuscarNumero);
        pnlBuscarNumero.setLayout(pnlBuscarNumeroLayout);
        pnlBuscarNumeroLayout.setHorizontalGroup(
            pnlBuscarNumeroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlBuscarNumeroLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel31)
                .addGap(18, 18, 18)
                .addGroup(pnlBuscarNumeroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtNumModCDP)
                    .addComponent(btnNumModCDP, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE))
                .addContainerGap(48, Short.MAX_VALUE))
        );
        pnlBuscarNumeroLayout.setVerticalGroup(
            pnlBuscarNumeroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlBuscarNumeroLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnlBuscarNumeroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel31)
                    .addComponent(txtNumModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnNumModCDP)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pnlDatosPersoGara, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(btnMenuPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(171, 171, 171)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(chkFolioModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(pnlBuscarFolio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(33, 33, 33)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(chkNumModCDP)
                                    .addComponent(pnlBuscarNumero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(0, 80, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(chkNumModCDP)
                    .addComponent(chkFolioModCDP, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pnlBuscarFolio, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pnlBuscarNumero, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(49, 49, 49)
                .addComponent(pnlDatosPersoGara, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(113, 113, 113)
                .addComponent(btnMenuPrincipal)
                .addContainerGap(73, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("INFO. GARANTE", jPanel1);

        pnlDescripGarantia.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "DESCRIPCIÓN GARANTIA", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        txtOtroComentarioModCDP.setColumns(20);
        txtOtroComentarioModCDP.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        txtOtroComentarioModCDP.setRows(5);
        txtOtroComentarioModCDP.setToolTipText("");
        jScrollPane3.setViewportView(txtOtroComentarioModCDP);

        txtDescripcionModCDP.setBackground(new java.awt.Color(255, 255, 102));
        txtDescripcionModCDP.setColumns(20);
        txtDescripcionModCDP.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        txtDescripcionModCDP.setRows(5);
        txtDescripcionModCDP.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtDescripcionModCDP.setEnabled(false);
        jScrollPane4.setViewportView(txtDescripcionModCDP);

        lblDescripcion.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblDescripcion.setText("DESCRIPCIÓN");

        javax.swing.GroupLayout pnlDescripGarantiaLayout = new javax.swing.GroupLayout(pnlDescripGarantia);
        pnlDescripGarantia.setLayout(pnlDescripGarantiaLayout);
        pnlDescripGarantiaLayout.setHorizontalGroup(
            pnlDescripGarantiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDescripGarantiaLayout.createSequentialGroup()
                .addGap(70, 70, 70)
                .addComponent(lblDescripcion)
                .addGap(18, 18, 18)
                .addGroup(pnlDescripGarantiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 586, Short.MAX_VALUE)
                    .addComponent(jScrollPane3))
                .addContainerGap())
        );
        pnlDescripGarantiaLayout.setVerticalGroup(
            pnlDescripGarantiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlDescripGarantiaLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnlDescripGarantiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblDescripcion)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(31, 31, 31)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(250, 250, 250))
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlDescripGarantia, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlDescripGarantia, javax.swing.GroupLayout.PREFERRED_SIZE, 359, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(107, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("DESCRIP. GARANTÍA", jPanel2);

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "MODIFICACIÓN GARANTÍA CDP", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        jLabel4.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel4.setText("SUCURSAL");

        jLabel5.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel5.setText("FECHA CREACIÓN");

        jLabel6.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel6.setText("FECHA ÚLT. DEBITO");

        cmbSucursalModCDP.setEditable(true);
        cmbSucursalModCDP.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
        cmbSucursalModCDP.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione" }));
        cmbSucursalModCDP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmbSucursalModCDPActionPerformed(evt);
            }
        });

        jLabel13.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel13.setText("FECHA MODIFICA.");

        jLabel12.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel12.setText("FECHA ÚLT. TASACIÓN");

        jLabel11.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel11.setText("MONEDA");

        cmbMonedaModCDP.setEditable(true);
        cmbMonedaModCDP.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
        cmbMonedaModCDP.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione" }));

        txtFechaCreacion.setEditable(false);
        txtFechaCreacion.setBackground(new java.awt.Color(255, 255, 0));

        jLabel14.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel14.setText("NÚMERO CDP");

        txtNumeroCDPMOD.setEditable(false);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel12)
                    .addComponent(jLabel13)
                    .addComponent(jLabel11)
                    .addComponent(jLabel6)
                    .addComponent(jLabel5)
                    .addComponent(jLabel4)
                    .addComponent(jLabel14))
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(cmbMonedaModCDP, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cmbSucursalModCDP, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jcUltimoDebito, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jcUltimaTasacion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jcFechaModifica, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtFechaCreacion)
                    .addComponent(txtNumeroCDPMOD))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(cmbSucursalModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel6))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(txtFechaCreacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jcUltimoDebito, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(cmbMonedaModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel12)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel13))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jcUltimaTasacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jcFechaModifica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel14)
                    .addComponent(txtNumeroCDPMOD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(32, Short.MAX_VALUE))
        );

        jLabel7.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel7.setText("TIPO GARANTÍA");

        jLabel8.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel8.setText("FECHA EXTINCIÓN");

        jLabel9.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel9.setText("FECHA ÚLT. REVAL.");

        jLabel10.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel10.setText("FECHA ÚLT. CRÉDITO");

        cmbGtiaModCDP.setEditable(true);
        cmbGtiaModCDP.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
        cmbGtiaModCDP.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione" }));
        cmbGtiaModCDP.setToolTipText("");

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel10)
                    .addComponent(jLabel9)
                    .addComponent(jLabel8)
                    .addComponent(jLabel7))
                .addGap(18, 18, 18)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(cmbGtiaModCDP, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jcFechaExtincion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jcUltimoRevaluo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jcUltimoCredito, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(cmbGtiaModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel8)
                    .addComponent(jcFechaExtincion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel9)
                    .addComponent(jcUltimoRevaluo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel10)
                    .addComponent(jcUltimoCredito, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "ADJUNTAR ARCHIVO", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        jLabel16.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel16.setText("ARCHIVO");

        txtArchivo1ModCDP.setEditable(false);

        btnExaminarModCDP.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnExaminarModCDP.setText("EXAMINAR");
        btnExaminarModCDP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnExaminarModCDPActionPerformed(evt);
            }
        });

        btnAdjuntarModCDP.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnAdjuntarModCDP.setText("ADJUNTAR");
        btnAdjuntarModCDP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAdjuntarModCDPActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel16)
                .addGap(18, 18, 18)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel10Layout.createSequentialGroup()
                        .addComponent(btnExaminarModCDP)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnAdjuntarModCDP))
                    .addComponent(txtArchivo1ModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(13, Short.MAX_VALUE))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(txtArchivo1ModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnExaminarModCDP)
                    .addComponent(btnAdjuntarModCDP))
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 154, Short.MAX_VALUE)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(97, Short.MAX_VALUE))
        );

        btnMenuPricModCDP.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnMenuPricModCDP.setText("MENÚ PRINCIPAL >>");
        btnMenuPricModCDP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMenuPricModCDPActionPerformed(evt);
            }
        });

        btnActualizarModCDP.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnActualizarModCDP.setText("ACTUALIZAR");
        btnActualizarModCDP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnActualizarModCDPActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnActualizarModCDP)
                        .addGap(328, 328, 328))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(btnMenuPricModCDP, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnMenuPricModCDP)
                    .addComponent(btnActualizarModCDP))
                .addContainerGap(68, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("MODIFICACIÓN GARANTÍA CDP", jPanel3);

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "ÁREA IMPRESIÓN", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        tbSalidaImprimirCdp.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        tbSalidaImprimirCdp.setEnabled(false);
        jScrollPane1.setViewportView(tbSalidaImprimirCdp);

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1)
                .addContainerGap())
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "INGRESE NÚMERO CDP", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        btnBuscarCdpImprimir.setText("BUSCAR");
        btnBuscarCdpImprimir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarCdpImprimirActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel11Layout.createSequentialGroup()
                .addContainerGap(30, Short.MAX_VALUE)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtBuscarCdpImprimir, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnBuscarCdpImprimir, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26))
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(txtBuscarCdpImprimir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnBuscarCdpImprimir)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        btnImprimirCdp.setText("IMPRIMIR");
        btnImprimirCdp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnImprimirCdpActionPerformed(evt);
            }
        });

        btnMenuPrincipalCdp.setText("MENÚ PRINCIPAL");
        btnMenuPrincipalCdp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMenuPrincipalCdpActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                        .addGap(0, 285, Short.MAX_VALUE)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                                .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(303, 303, 303))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                                .addComponent(btnImprimirCdp, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(177, 177, 177)
                                .addComponent(btnMenuPrincipalCdp, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(24, 24, 24))))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                        .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnImprimirCdp)
                    .addComponent(btnMenuPrincipalCdp))
                .addContainerGap(12, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("IMPRIMIR", jPanel7);

        jLabel3.setText("MENÚ PRINCIPAL\\MODIFICACIÓN GARANTÍA CDP");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(118, 118, 118)
                        .addComponent(jLabel1))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel3)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 800, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING))
                .addGap(18, 18, 18)
                .addComponent(jTabbedPane1))
        );

        setSize(new java.awt.Dimension(816, 648));
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void btnMenuPrincipalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMenuPrincipalActionPerformed
        MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
        venMenuPrincipal.setVisible(true);
        ModificacionGarantiaCdp.this.dispose();
    }//GEN-LAST:event_btnMenuPrincipalActionPerformed

    private void btnFolioModCDPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFolioModCDPActionPerformed
        limpiar();
        try
        {
             if(this.txtFolioModCDP.getText().length() > 0)
            {
            
            if (!this.txtFolioModCDP.getText().matches("[ 0-9]*")) // expresiones regulares para validar
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese solo números");
            this.txtFolioModCDP.setText("");
            this.txtNumModCDP.setText("");
            this.btnActualizarModCDP.setVisible(false);
        }
        else
        {
        garaCdp = reg.buscarPorFolioCDP(Integer.parseInt(this.txtFolioModCDP.getText().trim()));
        if(garaCdp.getFolio_cdp() == 0)
        {
            javax.swing.JOptionPane.showMessageDialog(null, "Garantia NO ENCONTRADA");
            txtFolioModCDP.setText("");
            this.txtNumModCDP.setText("");
            this.btnActualizarModCDP.setVisible(false);
        }
        else
        {
            if(garaCdp.getEstado_cdp() == null)
            {
            this.txtRutModCDP.setText(garaCdp.getRut_gara_cdp());
            this.txtNombreModCDP.setText(garaCdp.getNombre_cdp());
            this.txtApellPatModCDP.setText(garaCdp.getApell_paterno_cdp());
            this.txtApellMatModCDP.setText(garaCdp.getApell_materno_cdp());
//            this.txtFolioGarModiCDP.setText(String.valueOf(garaCdp.getFolio_cdp()));
            this.txtDescripcionModCDP.setText(garaCdp.getDescrip_cdp());
            this.txtOtroComentarioModCDP.setText(garaCdp.getComent_cdp());
            //this.cmbSucursalModCDP.setSelectedItem(garaCdp.getSucu_cdp().toString());
            String fechaCreacion = (new SimpleDateFormat("dd/MM/yyyy").format(garaCdp.getFech_crea_cdp()));  
            txtFechaCreacion.setText(fechaCreacion);
            Date aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_ult_deb_cdp());
            this.jcUltimoDebito.setDate(aux);
            this.cmbSucursalModCDP.setSelectedItem(garaCdp.getSucu_cdp().toString());
            this.cmbMonedaModCDP.setSelectedItem(garaCdp.getNom_moneda_cdp().toString());
            aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_ult_tasa_cdp());
            this.jcUltimaTasacion.setDate(aux);
            aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_modif_cdp());
            this.jcFechaModifica.setDate(aux);
            this.cmbGtiaModCDP.setSelectedItem(garaCdp.getTipo_garantia_cdp().toString());
            this.jcFechaExtincion.setDate(garaCdp.getFech_extin_cdp());
            aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_ult_reval_cdp());
            this.jcUltimoRevaluo.setDate(aux);
            aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_ult_cred_cdp());
            this.jcUltimoCredito.setDate(aux);
            this.txtNumeroCDPMOD.setText(String.valueOf(garaCdp.getNum_cdp()));
            javax.swing.JOptionPane.showMessageDialog(this, "Aun no ha sido Aprobado");
            this.btnActualizarModCDP.setVisible(true);
            
            }
            this.txtNumeroCDPMOD.setText(String.valueOf(garaCdp.getNum_cdp()));
            this.txtRutModCDP.setText(garaCdp.getRut_gara_cdp());
            this.txtNombreModCDP.setText(garaCdp.getNombre_cdp());
            this.txtApellPatModCDP.setText(garaCdp.getApell_paterno_cdp());
            this.txtApellMatModCDP.setText(garaCdp.getApell_materno_cdp());
//            this.txtFolioGarModiCDP.setText(String.valueOf(garaCdp.getFolio_cdp()));
            this.txtDescripcionModCDP.setText(garaCdp.getDescrip_cdp());
            this.txtOtroComentarioModCDP.setText(garaCdp.getComent_cdp());
            //this.cmbSucursalModCDP.setSelectedItem(garaCdp.getSucu_cdp().toString());
            String fechaCreacion = (new SimpleDateFormat("dd/MM/yyyy").format(garaCdp.getFech_crea_cdp()));
            txtFechaCreacion.setText(fechaCreacion);
            Date aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_ult_deb_cdp());
            this.jcUltimoDebito.setDate(aux);
            this.cmbSucursalModCDP.setSelectedItem(garaCdp.getSucu_cdp().toString());
            this.cmbMonedaModCDP.setSelectedItem(garaCdp.getNom_moneda_cdp().toString());
            aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_ult_tasa_cdp());
            this.jcUltimaTasacion.setDate(aux);
            aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_modif_cdp());
            this.jcFechaModifica.setDate(aux);
            this.cmbGtiaModCDP.setSelectedItem(garaCdp.getTipo_garantia_cdp().toString());
            this.jcFechaExtincion.setDate(garaCdp.getFech_extin_cdp());
            aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_ult_reval_cdp());
            this.jcUltimoRevaluo.setDate(aux);
            aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_ult_cred_cdp());
            this.jcUltimoCredito.setDate(aux);
            this.btnActualizarModCDP.setVisible(true);
            
            this.txtNumModCDP.setText("");
            if (garaCdp.getEstado_cdp().equalsIgnoreCase("Aprobada")) {
                javax.swing.JOptionPane.showMessageDialog(null, "Esta garantia ya fue aprobada. No puede ser modificada.");
                MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
                venMenuPrincipal.setVisible(true);
                ModificacionGarantiaCdp.this.dispose();
                this.txtNumModCDP.setText("");
            }
            if (garaCdp.getEstado_cdp().equalsIgnoreCase("Rechazada")) {
                javax.swing.JOptionPane.showMessageDialog(null, "Esta garantia fue rechazada.");
                this.txtNumModCDP.setText("");
                this.btnActualizarModCDP.setVisible(true);
            }
            
        }}}else
            {
                javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Número de Folio");
                this.txtNumModCDP.setText("");
                this.btnActualizarModCDP.setVisible(false);
            }
        }catch(Exception e)
        {
            e.getMessage();   
        }
    }//GEN-LAST:event_btnFolioModCDPActionPerformed

    private void btnNumModCDPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNumModCDPActionPerformed
        limpiar();
        try
        {
            if(this.txtNumModCDP.getText().length() > 0)
            {
           if (!this.txtNumModCDP.getText().matches("[ 0-9]*")) // expresiones regulares para validar
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese solo números");
            this.txtFolioModCDP.setText("");
            this.txtNumModCDP.setText("");
            this.btnActualizarModCDP.setVisible(false);
        }
        else
        {
        garaCdp = reg.buscarPorNum(Integer.parseInt(this.txtNumModCDP.getText().trim()));
        if(garaCdp.getFolio_cdp() == 0)
        {
            javax.swing.JOptionPane.showMessageDialog(null, "Garantia NO ENCONTRADA");
            txtNumModCDP.setText("");
            this.txtFolioModCDP.setText("");
            this.btnActualizarModCDP.setVisible(false);
        }
        else
        {
            if(garaCdp.getEstado_cdp() == null)
            {
            this.txtRutModCDP.setText(garaCdp.getRut_gara_cdp());
            this.txtNombreModCDP.setText(garaCdp.getNombre_cdp());
            this.txtApellPatModCDP.setText(garaCdp.getApell_paterno_cdp());
            this.txtApellMatModCDP.setText(garaCdp.getApell_materno_cdp());
//            this.txtFolioGarModiCDP.setText(String.valueOf(garaCdp.getFolio_cdp()));
            this.txtDescripcionModCDP.setText(garaCdp.getDescrip_cdp());
            this.txtOtroComentarioModCDP.setText(garaCdp.getComent_cdp());
            //this.cmbSucursalModCDP.setSelectedItem(garaCdp.getSucu_cdp().toString());
            String fechaCreacion = (new SimpleDateFormat("dd/MM/yyyy").format(garaCdp.getFech_crea_cdp()));
            txtFechaCreacion.setText(fechaCreacion);
            Date aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_ult_deb_cdp());
            this.jcUltimoDebito.setDate(aux);
            this.cmbSucursalModCDP.setSelectedItem(garaCdp.getSucu_cdp().toString());
            this.cmbMonedaModCDP.setSelectedItem(garaCdp.getNom_moneda_cdp().toString());
            aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_ult_tasa_cdp());
            this.jcUltimaTasacion.setDate(aux);
            aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_modif_cdp());
            this.jcFechaModifica.setDate(aux);
            this.cmbGtiaModCDP.setSelectedItem(garaCdp.getTipo_garantia_cdp().toString());
            this.jcFechaExtincion.setDate(garaCdp.getFech_extin_cdp());
            aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_ult_reval_cdp());
            this.jcUltimoRevaluo.setDate(aux);
            aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_ult_cred_cdp());
            this.jcUltimoCredito.setDate(aux);
            this.txtNumeroCDPMOD.setText(String.valueOf(garaCdp.getNum_cdp()));
            javax.swing.JOptionPane.showMessageDialog(this, "Aun no ha sido Aprobado");
            this.btnActualizarModCDP.setVisible(true);
            this.txtFolioModCDP.setText("");
            }
            this.txtNumeroCDPMOD.setText(String.valueOf(garaCdp.getNum_cdp()));
            this.txtRutModCDP.setText(garaCdp.getRut_gara_cdp());
            this.txtNombreModCDP.setText(garaCdp.getNombre_cdp());
            this.txtApellPatModCDP.setText(garaCdp.getApell_paterno_cdp());
            this.txtApellMatModCDP.setText(garaCdp.getApell_materno_cdp());
//            this.txtFolioGarModiCDP.setText(String.valueOf(garaCdp.getFolio_cdp()));
            this.txtDescripcionModCDP.setText(garaCdp.getDescrip_cdp());
            this.txtOtroComentarioModCDP.setText(garaCdp.getComent_cdp());
            //this.cmbSucursalModCDP.setSelectedItem(garaCdp.getSucu_cdp().toString());
            String fechaCreacion = (new SimpleDateFormat("dd/MM/yyyy").format(garaCdp.getFech_crea_cdp()));
            txtFechaCreacion.setText(fechaCreacion);
            Date aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_ult_deb_cdp());
            this.jcUltimoDebito.setDate(aux);
            this.cmbSucursalModCDP.setSelectedItem(garaCdp.getSucu_cdp().toString());
            this.cmbMonedaModCDP.setSelectedItem(garaCdp.getNom_moneda_cdp().toString());
            aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_ult_tasa_cdp());
            this.jcUltimaTasacion.setDate(aux);
            aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_modif_cdp());
            this.jcFechaModifica.setDate(aux);
            this.cmbGtiaModCDP.setSelectedItem(garaCdp.getTipo_garantia_cdp().toString());
            this.jcFechaExtincion.setDate(garaCdp.getFech_extin_cdp());
            aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_ult_reval_cdp());
            this.jcUltimoRevaluo.setDate(aux);
            aux = DTO.ConversionFechas.convertToDate(garaCdp.getFech_ult_cred_cdp());
            this.jcUltimoCredito.setDate(aux);
            
            this.btnActualizarModCDP.setVisible(true);
            this.txtFolioModCDP.setText("");
            
            if (garaCdp.getEstado_cdp().equalsIgnoreCase("Aprobada")) {
                javax.swing.JOptionPane.showMessageDialog(null, "Esta garantia ya fue aprobada. No puede ser modificada.");
                MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
                venMenuPrincipal.setVisible(true);
                ModificacionGarantiaCdp.this.dispose();
                this.txtFolioModCDP.setText("");
            }
            if (garaCdp.getEstado_cdp().equalsIgnoreCase("Rechazada")) {
                javax.swing.JOptionPane.showMessageDialog(null, "Esta garantia fue rechazada.");
                this.txtFolioModCDP.setText("");
                this.btnActualizarModCDP.setVisible(true);
            }
        }}}
        else{
                javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Número CDP");
                this.txtFolioModCDP.setText("");
                this.btnActualizarModCDP.setVisible(false);
            }
        }catch(Exception e)
        {
            e.getMessage();
            
        }
    }//GEN-LAST:event_btnNumModCDPActionPerformed

    private void btnActualizarModCDPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnActualizarModCDPActionPerformed
        try {
            garaCdp.setNum_cdp(Integer.parseInt(txtNumeroCDPMOD.getText()));
            garaCdp.setComent_cdp(txtOtroComentarioModCDP.getText());
            garaCdp.setSucu_cdp(this.cmbSucursalModCDP.getSelectedItem().toString());
            Date fechaCreacion = (new SimpleDateFormat("dd/MM/yyyy").parse(txtFechaCreacion.getText()));
            garaCdp.setFech_crea_cdp(fechaCreacion);
            garaCdp.setFech_ult_deb_cdp(new SimpleDateFormat("dd/MM/yyyy").format(jcUltimoDebito.getDate()));
            garaCdp.setNom_moneda_cdp(this.cmbMonedaModCDP.getSelectedItem().toString());
            garaCdp.setFech_ult_tasa_cdp(new SimpleDateFormat("dd/MM/yyyy").format(jcUltimaTasacion.getDate()));
            garaCdp.setFech_modif_cdp(new SimpleDateFormat("dd/MM/yyyy").format(jcFechaModifica.getDate()));           
            garaCdp.setTipo_garantia_cdp(this.cmbGtiaModCDP.getSelectedItem().toString());
            garaCdp.setFech_ult_deb_cdp(new SimpleDateFormat("dd/MM/yyyy").format(jcUltimoDebito.getDate()));
            garaCdp.setFech_extin_cdp(new Date(jcFechaExtincion.getDate().getTime()));
            garaCdp.setFech_ult_reval_cdp(new SimpleDateFormat("dd/MM/yyyy").format(jcUltimoRevaluo.getDate()));           
            garaCdp.setFech_ult_cred_cdp(new SimpleDateFormat("dd/MM/yyyy").format(jcUltimoCredito.getDate()));          
            garaCdp.setAdjuntar_cdp(this.txtArchivo1ModCDP.getText().trim());
            int respuesta = javax.swing.JOptionPane.showConfirmDialog(null, "Esta seguro de modificar esta Garantia ?", "Actualizar Datos", JOptionPane.OK_CANCEL_OPTION);
            if (respuesta == 0) {
                reg.modificarGtiaCdpPorCDP(garaCdp, user);
                javax.swing.JOptionPane.showMessageDialog(this, "Garantia CDP modificada con Exito");
                MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
        venMenuPrincipal.setVisible(true);
        ModificacionGarantiaCdp.this.dispose();
            }
            else
            {
                
            }
        } catch (Exception z) {
            javax.swing.JOptionPane.showMessageDialog(this, "Problema en el BTN GRABAR");
        }
    }//GEN-LAST:event_btnActualizarModCDPActionPerformed

    private void btnMenuPricModCDPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMenuPricModCDPActionPerformed
        MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
        venMenuPrincipal.setVisible(true);
        ModificacionGarantiaCdp.this.dispose();
    }//GEN-LAST:event_btnMenuPricModCDPActionPerformed

    private void chkFolioModCDPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkFolioModCDPActionPerformed
        if (chkFolioModCDP.isSelected()) {
            pnlBuscarFolio.setVisible(true);
            pnlBuscarNumero.setVisible(false);
        }
        else
        {
            pnlBuscarFolio.setVisible(false);
        }
    }//GEN-LAST:event_chkFolioModCDPActionPerformed

    private void chkNumModCDPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkNumModCDPActionPerformed
        if (chkNumModCDP.isSelected()) {
            pnlBuscarFolio.setVisible(false);
            pnlBuscarNumero.setVisible(true);
        }
        else
        {
            pnlBuscarNumero.setVisible(false);
        }
    }//GEN-LAST:event_chkNumModCDPActionPerformed

    private void btnExaminarModCDPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExaminarModCDPActionPerformed
        JFileChooser filechooser = new JFileChooser();
        int opcion = filechooser.showOpenDialog(this);
        if (opcion==JFileChooser.APPROVE_OPTION){
            txtArchivo1ModCDP.setText(filechooser.getSelectedFile().getPath());
        }
    }//GEN-LAST:event_btnExaminarModCDPActionPerformed

    private void btnAdjuntarModCDPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAdjuntarModCDPActionPerformed
                                                    
        if(!this.txtArchivo1ModCDP.getText().equals("")){
        
        garaCdp.setAdjuntar_cdp(this.txtArchivo1ModCDP.getText().trim());
        javax.swing.JOptionPane.showMessageDialog(this, "Archivo guardado");
        }else{
        javax.swing.JOptionPane.showMessageDialog(this, "Adjunte archivo");
        }
    }//GEN-LAST:event_btnAdjuntarModCDPActionPerformed

    private void cmbSucursalModCDPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbSucursalModCDPActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cmbSucursalModCDPActionPerformed

    private void btnBuscarCdpImprimirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarCdpImprimirActionPerformed
       try
       {
           ArrayList<garantiaCdpOtrosDTO> salida = reg.ListarPorCdp(Integer.parseInt(this.txtBuscarCdpImprimir.getText().trim()));
           if(salida.isEmpty())
           {
               
               this.txtBuscarCdpImprimir.setText(null);
               DefaultTableModel modelo = (DefaultTableModel)this.tbSalidaImprimirCdp.getModel();
               modelo.setNumRows(0);
               javax.swing.JOptionPane.showMessageDialog(this, "No hay garantias registradas!");
           }
           else
           {
               
               DefaultTableModel modelo = (DefaultTableModel)this.tbSalidaImprimirCdp.getModel();
               modelo.setColumnCount(0);
               
               if(modelo.getColumnCount() < 1)
                {
                    
                    Object[] arr1 ={"Rut: ","Nombre: ", "Calle: ", "Garantía: ", "Número identificatorio CDP: ",
                        "Número de folio: ", "Monto incial: ", "Creación de la garantía: ", "Sucursal: ",
                        "Fecha último debito: ","Moneda: ","Fecha última tasación","Tipo garantía: ","Fecha vencimiento: ",
                        "Fecha último revaluo: ","Fecha último credito: ","Estado de la garantía: ","Fecha aprobado/Rechazado: ",
                        "Fecha de modificación: ",
                        "Usuario: " };
                    modelo.addColumn("Concepto", arr1);
                    
                    for(garantiaCdpOtrosDTO c: salida)
                {
                    Object[] arr2 ={
                                   c.getRut_gara_cdp(),
                                   c.getNombre_cdp() + "  " + c.getApell_paterno_cdp() + "  " + c.getApell_materno_cdp(),
                                   c.getCalle_cdp() + "  " + c.getNumero_calle_cdp(),
                                   c.getNom_garantia_cdp(),
                                   c.getNum_cdp(),
                                   c.getFolio_cdp(),
                                   c.getMonto_inicial(),
                                   c.getFech_crea_cdp(),
                                   c.getSucu_cdp(),
                                   c.getFech_ult_deb_cdp(),
                                   c.getNom_moneda_cdp(),
                                   c.getFech_ult_tasa_cdp(),
                                   c.getTipo_garantia_cdp(),
                                   c.getFech_extin_cdp(),
                                   c.getFech_ult_reval_cdp(),
                                   c.getFech_ult_cred_cdp(),
                                   c.getEstado_cdp(),
                                   c.getFech_crea_cdp(),
                                   c.getFech_modif_cdp(),
                                   c.getNombre_usuario()
                    };
                     
                    modelo.addColumn("Contenido",arr2);    
                }
                    
                    Object[] arr3 = {" "," "," "," "," "," "," "," "," "," ",
                                     " "," "," "," "," "," "," "," "," "," "};
                    modelo.addColumn("Observaciones",arr3);
                    
                }
    
           }
       }
       catch(Exception e)
       {
           e.getMessage();
       }
    }//GEN-LAST:event_btnBuscarCdpImprimirActionPerformed

    private void btnImprimirCdpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImprimirCdpActionPerformed
         try {
            
        int fila= 0;
  
        List Resultados = new ArrayList();
        ComprobanteGeneralDTO tipo;
        Resultados.clear();
        
        for(fila = 0; fila< tbSalidaImprimirCdp.getRowCount(); fila++)
        {
            
           tipo = new ComprobanteGeneralDTO(String.valueOf(tbSalidaImprimirCdp.getValueAt(fila, 0)),
                    " " + String.valueOf(tbSalidaImprimirCdp.getValueAt(fila, 1)), " " + String.valueOf(tbSalidaImprimirCdp.getValueAt(fila, 2))  + "\n");
           Resultados.add(tipo);

        }
        
            String reportSource = "C:\\Users\\SoftGroup\\Documents\\NetBeansProjects\\trunk\\AppGarantias\\build\\classes\\Reporte\\ComprobanteGeneralGarantias.jrxml";

            JasperReport jr = JasperCompileManager.compileReport(reportSource);
            
            
            JFrame reporte = new JFrame();
            reporte.setSize(900, 700);
            reporte.setLocationRelativeTo(null);
            reporte.setTitle("IMPRESIÓN");
            String fechaImpresion = String.valueOf(Fechas.FechaSistema());
            
            Map<String, Object> map = new HashMap<String, Object>();
            
            map.put("Titulo", "Sistema Gestión de Garantías Bancarias");
            map.put("fecha", fechaImpresion);
            map.put("nombreBanco", "Banco xxxxxx");
            map.put("subtitulo", "Comprobante Modificación CDP");
            map.put("timbre", "Timbre");
            map.put("fechaUsuario","Fecha");
            map.put("firma","Firma");
            
            
            JRBeanCollectionDataSource coleccion = new JRBeanCollectionDataSource(Resultados);
            JasperPrint jp = JasperFillManager.fillReport(jr, map, coleccion);
            JRViewer jv = new JRViewer(jp);
            reporte.getContentPane().add(jv);
            reporte.setVisible(true);
            
            
            
        } catch (JRException e) {
            e.printStackTrace();
            Logger.getLogger(ModificacionGarantiaCdp.class.getName()).log(Level.SEVERE, null, e);
        }
    }//GEN-LAST:event_btnImprimirCdpActionPerformed

    private void btnMenuPrincipalCdpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMenuPrincipalCdpActionPerformed
        MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
        venMenuPrincipal.setVisible(true);
        ModificacionGarantiaCdp.this.dispose();
    }//GEN-LAST:event_btnMenuPrincipalCdpActionPerformed
    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        /*
//         * Set the Nimbus look and feel
//         */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /*
//         * If Nimbus (introduced in Java SE 6) is not available, stay with the
//         * default look and feel. For details see
//         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(ModificacionGarantiaCdp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(ModificacionGarantiaCdp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(ModificacionGarantiaCdp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(ModificacionGarantiaCdp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>
//
//        /*
//         * Create and display the form
//         */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//
//            public void run() {
//                new ModificacionGarantiaCdp().setVisible(true);
//            }
//        });
//    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnActualizarModCDP;
    private javax.swing.JButton btnAdjuntarModCDP;
    private javax.swing.JButton btnBuscarCdpImprimir;
    private javax.swing.JButton btnExaminarModCDP;
    private javax.swing.JButton btnFolioModCDP;
    private javax.swing.JButton btnImprimirCdp;
    private javax.swing.JButton btnMenuPricModCDP;
    private javax.swing.JButton btnMenuPrincipal;
    private javax.swing.JButton btnMenuPrincipalCdp;
    private javax.swing.JButton btnNumModCDP;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JCheckBox chkFolioModCDP;
    private javax.swing.JCheckBox chkNumModCDP;
    private javax.swing.JComboBox cmbGtiaModCDP;
    private javax.swing.JComboBox cmbMonedaModCDP;
    private javax.swing.JComboBox cmbSucursalModCDP;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JTabbedPane jTabbedPane1;
    private com.toedter.calendar.JDateChooser jcFechaExtincion;
    private com.toedter.calendar.JDateChooser jcFechaModifica;
    private com.toedter.calendar.JDateChooser jcUltimaTasacion;
    private com.toedter.calendar.JDateChooser jcUltimoCredito;
    private com.toedter.calendar.JDateChooser jcUltimoDebito;
    private com.toedter.calendar.JDateChooser jcUltimoRevaluo;
    private javax.swing.JLabel lblDescripcion;
    private javax.swing.JPanel pnlBuscarFolio;
    private javax.swing.JPanel pnlBuscarNumero;
    private javax.swing.JPanel pnlDatosPersoGara;
    private javax.swing.JPanel pnlDescripGarantia;
    private javax.swing.JTable tbSalidaImprimirCdp;
    private javax.swing.JTextField txtApellMatModCDP;
    private javax.swing.JTextField txtApellPatModCDP;
    private javax.swing.JTextField txtArchivo1ModCDP;
    private javax.swing.JTextField txtBuscarCdpImprimir;
    private javax.swing.JTextArea txtDescripcionModCDP;
    private javax.swing.JTextField txtFechaCreacion;
    private javax.swing.JTextField txtFolioModCDP;
    private javax.swing.JTextField txtNombreModCDP;
    private javax.swing.JTextField txtNumModCDP;
    private javax.swing.JTextField txtNumeroCDPMOD;
    private javax.swing.JTextArea txtOtroComentarioModCDP;
    private javax.swing.JTextField txtRutModCDP;
    // End of variables declaration//GEN-END:variables

    private void limpiar() {
            this.txtRutModCDP.setText(null);
            this.txtNombreModCDP.setText(null);
            this.txtApellPatModCDP.setText(null);
            this.txtApellMatModCDP.setText(null);
//            this.txtFolioGarModiCDP.setText(null);
            this.txtDescripcionModCDP.setText(null);
            this.txtOtroComentarioModCDP.setText(null);
            this.txtFechaCreacion.setText(null);
            this.jcUltimoDebito.setCalendar(null);
            this.cmbSucursalModCDP.setSelectedItem("Seleccione");
            this.cmbMonedaModCDP.setSelectedItem("Seleccione");
            this.jcUltimaTasacion.setCalendar(null);
            this.jcFechaModifica.setCalendar(null);
            this.cmbGtiaModCDP.setSelectedItem("Seleccione");
            this.jcFechaExtincion.setCalendar(null);
            this.jcUltimoRevaluo.setCalendar(null);
            this.jcUltimoCredito.setCalendar(null);
    }
}
